<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>添加咨询</title>
    <?php PrintPageHead(); ?>
    <link href="../resource/css/hermes.css" rel="stylesheet">
    <link href="../resource/js/calendar/calendar-blue.css" type="text/css" rel="stylesheet">
    <script src="../resource/js/calendar/calendar.js" type="text/javascript"></script>
    <script src="../resource/js/hermes.js"></script>
    <?php
    if (!array_key_exists("公众号ID",$_SESSION)) {
        header("Location:back.php");
    }
    pdo()->beginTransaction();
    $bm=new C后台管理员();
    $添加咨询 = 'back.php?state=back13Add_ZiXun';
    $id=$_GET['id'];
    if($id){
        $咨询信息=pdo()->selectOne("select * from 咨询信息 WHERE id=".$id);
    }
    ?>
</head>
<body>


<div class="container-fluid">
    <?php include_once 'back_header.php'; ?>
    <div class="panel panel-primary">
        <div class="panel-heading text-center"><h3 class="panel-title"><?php if($_GET['id']){ echo "修改";}else{ echo "添加";}?>模板咨询</h3></div>
            <div style="padding: 30px 30px 10px;">
                <form class="bs-example bs-example-form" role="form">
                    <div class="input-group">
                        <span class="input-group-addon">标题</span>
                        <input type="text" class="form-control" value="<?php if($id){ echo $咨询信息['标题'];};?>" placeholder="输入咨询消息标题" name="标题">
                    </div>
                    <br>
                    <div class="input-group">
                        <span class="input-group-addon">发布人</span>
                        <input type="text" class="form-control" value="<?php if($id){ echo $咨询信息['发布人'];};?>" placeholder="输入咨询消息地址" name="发布人">
                    </div>
                    <br>
                    <div class="input-group">
                        <span class="input-group-addon">消息类别</span>
                        <input type="text" class="form-control" value="<?php if($id){ echo $咨询信息['消息类别'];};?>" placeholder="输入咨询消息消息类别" name="消息类别">
                    </div>
                    <br>
                    <div class="input-group">
                        <span class="input-group-addon">发布时间</span>
                        <input type="text" class="form-control" value="<?php if($id){ echo $咨询信息['发布时间'];};?>" placeholder="输入咨询消息发布时间" name="发布时间">
                    </div>
                    <br>
                    <div class="input-group">
                        <span class="input-group-addon">追加</span>
                        <input type="text" class="form-control" value="<?php if($id){ echo $咨询信息['追加'];};?>" placeholder="输入咨询消息追加信息" name="追加">
                    </div>
                    <br>
                    <div class="input-group">
                        <span class="input-group-addon">咨询模板ID</span>
                        <input type="text" class="form-control" value="<?php if($id){ echo $咨询信息['咨询模板ID'];};?>" placeholder="输入咨询模板ID" name="咨询模板ID">
                    </div>
                    <br>
                    <div class="input-group">
                        <input type="button" onclick="fun()" class="form-control btn btn-primary" value="提交">
                    </div>
                </form>
            </div>
    </div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="../resource/js/jquery-1.11.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../resource/js/bootstrap.min.js"></script>
<script src="../resource/js/jquery-form.js"></script>
<script language="JavaScript">

    $(function(){
        $(".fun").click(function(){
            $(this).next("div").show();
        })
        $(".fun1").click(function(){
            $(this).parent("div").hide();
        })
    });
    function fun(){
        url="BackSellerAjax.php?businessFlag=咨询信息";
        if('<?=$id?>'){
            url="BackSellerAjax.php?businessFlag=咨询信息&id=<?=$id?>";
        }

        $('form').ajaxSubmit({
            type:'post',
            url:url,
            success:function(msg) {
               if(!isNaN(msg)){
                   //alert('添加成功,请添加图文');
                   location.replace("back.php?state=back13Add_MuBan&id="+msg);
               }else{
                   alert(msg);
                   location.reload();
               }
            }
        })
    }


</script>
</body>
</html>